package domain

import (
	"gitee.com/tietang/terrace-go/v2/example/order"
)

func ToDTO(o order.Order) *order.OrderDTO {
	dto := &order.OrderDTO{}
	dto.TradeNo = o.TradeNo
	dto.Status = o.Status
	dto.Source = o.Source
	dto.PayType = o.PayType
	dto.SaleAmount = o.SaleAmount
	dto.PrivilegeAmount = o.PrivilegeAmount
	dto.TradeAmount = o.TradeAmount
	dto.PayAmount = o.PayAmount
	dto.BizDate = *o.BizDate
	return dto
}

func FromCreatedDTO(dto *order.OrderCreatedDTO) *order.Order {
	o := &order.Order{}
	o.Source = dto.Source
	o.PayType = dto.PayType
	o.SaleAmount = dto.SaleAmount
	o.PrivilegeAmount = dto.PrivilegeAmount
	o.TradeAmount = dto.TradeAmount
	o.PayAmount = dto.PayAmount
	return o
}
func FromDTO(dto *order.OrderDTO) *order.Order {
	o := &order.Order{}
	o.TradeNo = dto.TradeNo
	o.Status = dto.Status
	o.Source = dto.Source
	o.PayType = dto.PayType
	o.SaleAmount = dto.SaleAmount
	o.PrivilegeAmount = dto.PrivilegeAmount
	o.TradeAmount = dto.TradeAmount
	o.PayAmount = dto.PayAmount
	return o
}
